﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Grpc.Core;

using pb = global::Google.Protobuf;
using pbc = global::Google.Protobuf.Collections;
using pbr = global::Google.Protobuf.Reflection;
using scg = global::System.Collections.Generic;

namespace GRPCBase
{
    public sealed partial class TaskReply : pb::IMessage<TaskReply>
    {
        private static readonly pb::MessageParser<TaskReply> _parser = new pb::MessageParser<TaskReply>(() => new TaskReply());
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
        public static pb::MessageParser<TaskReply> Parser { get { return _parser; } }

        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
        public static pbr::MessageDescriptor Descriptor
        {
            get { return global::GRPCBase.TaskReflection.Descriptor.MessageTypes[1]; }
        }

        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
        pbr::MessageDescriptor pb::IMessage.Descriptor
        {
            get { return Descriptor; }
        }

        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
        public TaskReply()
        {
            OnConstruction();
        }

        partial void OnConstruction();

        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
        public TaskReply(TaskReply other) : this()
        {
            message_ = other.message_;
        }

        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
        public TaskReply Clone()
        {
            return new TaskReply(this);
        }

        /// <summary>Field number for the "message" field.</summary>
        public const int MessageFieldNumber = 1;
        private string message_ = "";
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
        public string Message
        {
            get { return message_; }
            set
            {
                message_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
            }
        }
        public TaskRequest TaskInfo
        {
            get;
            set;
        }
        /// <summary>
        /// 1超时，2执行成功，3执行失败 4已分配 5已提交 401提交失败 任务数过多
        /// </summary>
        public int Status
        {
            get;
            set;
        }
        public String ErrorMessage
        {
            get;
            set;
        }
        public Byte[] ResultData
        {
            get;
            set;
        }
     

        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
        public override bool Equals(object other)
        {
            return Equals(other as TaskReply);
        }

        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
        public bool Equals(TaskReply other)
        {
            if (ReferenceEquals(other, null))
            {
                return false;
            }
            if (ReferenceEquals(other, this))
            {
                return true;
            }
            if (Message != other.Message) return false;
            return true;
        }

        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
        public override int GetHashCode()
        {
            int hash = 1;
            if (Message.Length != 0) hash ^= Message.GetHashCode();
            return hash;
        }

        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
        public override string ToString()
        {
            return pb::JsonFormatter.ToDiagnosticString(this);
        }

        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
        public void WriteTo(pb::CodedOutputStream output)
        {
            if (Message.Length != 0)
            {
                output.WriteRawTag(10);
                output.WriteString(Message);
            }
        }

        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
        public int CalculateSize()
        {
            int size = 0;
            if (Message.Length != 0)
            {
                size += 1 + pb::CodedOutputStream.ComputeStringSize(Message);
            }
            return size;
        }

        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
        public void MergeFrom(TaskReply other)
        {
            if (other == null)
            {
                return;
            }
            if (other.Message.Length != 0)
            {
                Message = other.Message;
            }
        }

        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
        public void MergeFrom(pb::CodedInputStream input)
        {
            uint tag;
            while ((tag = input.ReadTag()) != 0)
            {
                switch (tag)
                {
                    default:
                        input.SkipLastField();
                        break;
                    case 10:
                        {
                            Message = input.ReadString();
                            break;
                        }
                }
            }
        }

    }

}
